<?php
/**
 * @version		0.2.0 joomla zmluvy $
 * @package		com_zjmluvy
 * @copyright	Copyright © 2011 - All rights reserved.
 * @license		GNU/GPL
 * @author    AdrianKo		
 * @website   http://code.google.com/p/joomla-zmluvy
 *
 *
 *1.3.2012
 */

// no direct access
defined('_JEXEC') or die('Restricted access');

class upravapartner extends JTable
{
	/**
	 * Primary Key
	 * @var int
	 */
	var $id 				= null;
	/** @var string */
	var $title 				= '';
 	/** @var string */
	var $meno 				= '';
 	/** @var string */
	var $ulica 				= '';
 	/** @var string */
	var $mesto 				= '';
 	/** @var string */
	var $psc 				= '';
 	/** @var string */
	var $stat 				= '';
 	/** @var string */
	var $description 				= '';
	/** @var int */
	var $published	 			= '';
	/** @var int */
//	var $checked_out 		= 0;
	/** @var date */
//	var $checked_out_time 	= 0;
  /** @var string */
	var $ico 				= '';
  /** @var string */
	var $dic 				= '';
  /** @var string */
	var $ic_dph 				= '';
  /** @var string */
  var $typ 				= 1;
  /** @var int */
	var $or_sud 		= 0;
	/** @var int */
	var $or_odd 	= 0;
  /** @var int */
	var $or_vlozka 		= 0;
  /** @var int */
	var $logo 		= '';
	


	function upravapartner(& $db) {
    $this->params	= &JComponentHelper::getParams('com_jzmluvy');
    parent::__construct('#__jzmluvy_partner', 'id', $db);
	}

	// overloaded check function
	function check()
	{

		$alias = JFilterOutput::stringURLSafe($this->title);

		if(empty($this->alias) || $this->alias === $alias ) {
			$this->alias = $alias;
		}
    
    if(empty($this->title)) {
			$this->_error = JText::_( 'pa_CHYBA_MENO' );
	    JError::raiseWarning('SOME_ERROR_CODE', $this->_error );
	    return false;
		}
    
    if( empty($this->ulica) || empty($this->mesto) || empty($this->psc) || empty($this->stat) ) {
			$this->_error = JText::_( 'pa_CHYBA_ADRESA' );
	    JError::raiseWarning('SOME_ERROR_CODE', $this->_error );
	    return false;
		}
         
 		return true;
	}
}
?>